Skip to main content

byteOr

Type

operator

Summary

Performs a "bitwise or" operation on each bit of two strings of binary data.

Syntax

<leftData> byteOr <rightData>

Description

Use the byteOr operator to operate directly on the bits of two binary strings.

For each bit of leftData, LiveCode performs an Or operation with the corresponding bit of rightData to produce a result. A bit is 1 if one or both of the corresponding bits of leftData and rightData are

  1. Otherwise, the bit is 0.

If the leftData and rightData are different lengths, the bytes of the shorter binary string are repeatedly used in order to produce the result.

Parameters

NameTypeDescription

leftData

binary data, or an expression that evaluates to binary data

rightData

binary data, or an expression that evaluates to binary data

Examples

/* Left data represented in memory as 00000011 00000010 */
local tLeftData
put numToByte(3) & numToByte(2) into tLeftData

/* Right data represented in memory as 00000010 00000001 */
local tRightData
put numToByte(2) & numToByte(1) into tRightData

/* Result represented in memory as 00000011 00000011 */
local tResult
put tLeftData byteOr tRightData into tResult

/* Equivalent to using bitOr and then converting to data */
put tResult is numToByte(3 bitOr 2) & numToByte(2 bitOr 1) -- true

glossary: operation, operator, bit, binary, operand, binary data

operator: or, byteNot

Compatibility and Support

Introduced

LiveCode 10.0

OS

mac

windows

linux

ios

android

Platforms

desktop

server

mobile

Thank you for your feedback!

Was this page helpful?